package org.tungse.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.tungse.service.UserService;

/**
 * @Author : Tungse
 * @Date: 2025/7/2 17:22
 * @Description:
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @DubboReference
//    @Autowired
    private UserService userService;

    @GetMapping("show")
    public String getUsers() throws JsonProcessingException {
        ObjectMapper objectMapper = new ObjectMapper();
        return objectMapper.writeValueAsString(userService.gerUserList());
    }
}
